package com.talkweb.securitycamera.utils.photocodeclib;

import ohos.media.image.PixelMap;
import ohos.media.image.common.Size;
import ohos.media.photokit.metadata.AVMetadataHelper;
import ohos.media.photokit.metadata.AVThumbnailUtils;

import java.io.File;

/**
 * @version 1.0.1
 * @description: 视频生成缩略图
 * @program: Gallery
 * @Author xiaozhijun
 * @Date 2020/12/22 14:43
 */
public class VideoThumbnail extends IThumbnail {


    @Override
    public PixelMap getThumbPixMap(File videoFile, Size size) {
        return createVideoThumbnail(videoFile, size);
    }

    /**
     * 获取视频第一帧图像创建缩略图
     *
     * @param file
     * @param size
     * @return
     */
    private PixelMap createVideoThumbnail(File file, Size size) {

        return AVThumbnailUtils.createVideoThumbnail(file, size);
    }
}
